import os
path = os.getcwd()+"\\ストパニもの\\RenpyOriginalScript\\" #path
filename = "ストパニもの01"
f1 = open(path+filename+"(eiq).txt","r",encoding='utf-8')
original_list = f1.readlines()
f1.close()
f2 = open(path+filename+".txt","r",encoding='utf-8')
text_lines = f2.readlines()
list = []
count = 0
for line in text_lines:
    if count == len(original_list):
        break
    else:
        if line == "\n":
            print("空行")
            continue
        if ("play music " in line) or ("scene bg" in line) or ("voice" in line):
            list.append(line)
            continue
        if line[0] == "\"":
            list.append("\""+original_list[count].strip("\n")+"\"\n")
            count += 1
            continue
        if "tu" in line:
            list.append("tu \""+original_list[count].strip("\n")+"\"\n")
            count += 1
            continue
        if "ta" in line:
            list.append("ta \""+original_list[count].strip("\n")+"\"\n")
            count += 1
            continue
        if "na" in line:
            list.append("na \""+original_list[count].strip("\n")+"\"\n")
            count += 1
            continue
        if "ya" in line:
            list.append("ya \""+original_list[count].strip("\n")+"\"\n")
            count += 1
            continue
f2.close()
with open(path+filename+"(tled).rpy","w",encoding="utf-8") as f3:
    for ScriptText in list:
        f3.write(ScriptText)